package com.meeting.controller;


import com.meeting.service.NoticeService;
import com.meeting.vo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/notice")
@Tag(name = "公告接口")
@Slf4j
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @GetMapping("/selectAll")
    @Operation(summary = "获取所有公告")
    public Result getAllNotices(@RequestParam(defaultValue = "1") Integer page,
                                @RequestParam(defaultValue = "10") Integer pageSize) {
        log.info("获取公告列表，页码：{}，每页数量：{}", page, pageSize);
        return noticeService.getAllNotices(page, pageSize);
    }

    @GetMapping("/{id}")
    @Operation(summary = "根据ID获取公告详情")
    public Result getNoticeById(@PathVariable Integer id) {
        log.info("获取公告详情，ID：{}", id);
        return noticeService.getNoticeById(id);
    }
}